if not %POCKETBOOKSDK%.==. goto C1
echo Environment variable POCKETBOOKSDK is not set
pause
:C1
set PATH=%POCKETBOOKSDK%\bin;%PATH%

set INCLUDE=-I%POCKETBOOKSDK%usr\include
set LIBS=-linkview -lpng -ljpeg -lz -lgdi32 -lpng -lfreetype -lcurl
set OUTPUT=imageviewer2.exe

rm -f %OUTPUT%
rm -f *.o

set IMAGES=
rem if not exist images\*.bmp goto NOIMG
rem set IMAGES=%TEMP%\images.temp.c
rem pbres -c %IMAGES% images/*.bmp
rem if errorlevel 1 goto L_ER
:NOIMG

%POCKETBOOKSDK%bin\g++ -static -fomit-frame-pointer -L%POCKETBOOKSDK%usr\lib %INCLUDE% -I./src -o %OUTPUT% src/*.cpp %IMAGES% %LIBS%
if errorlevel 1 goto L_ER

rem g++ -Wall -O2 -fomit-frame-pointer 
rem if errorlevel 1 goto L_ER

echo Built OK!
pause
exit 0

:L_ER
echo Built with ERRORS!
pause
exit 1 